From: addshore Date: Thu, 6 Mar 2014 19:23:22 +0000 (+0100) Subject: Add test for Message::params X-Git-Tag: 1.31.0-rc.0~16712^2 X-Git-Url: http://git.cyclocoop.org/%27%20.%20%24prefix%20.%20Wiki::transformTitleToURI%28%24matches%5B1%5D%29%20.%20%27?a=commitdiff_plain;h=c83f5d02ef2d333c2285a286d29a383d3b781171;p=lhc%2Fweb%2Fwiklou.git Add test for Message::params Change-Id: I66098828d72ac6cb594bf886d5a7f61a8616a1a0 --- diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php index 71ebd6a7d2..ab5c3f6036 100644 --- a/tests/phpunit/includes/MessageTest.php +++ b/tests/phpunit/includes/MessageTest.php @@ -10,6 +10,33 @@ class MessageTest extends MediaWikiLangTestCase { ) ); } + public function provideTestParams() { + return array( + array( array() ), + array( array( 'foo' ), 'foo' ), + array( array( 'foo', 'bar' ), 'foo', 'bar' ), + array( array( 'baz' ), array( 'baz' ) ), + array( array( 'baz', 'foo' ), array( 'baz', 'foo' ) ), + array( array( 'baz', 'foo' ), array( 'baz', 'foo' ), 'hhh' ), + array( array( 'baz', 'foo' ), array( 'baz', 'foo' ), 'hhh', array( 'ahahahahha' ) ), + array( array( 'baz', 'foo' ), array( 'baz', 'foo' ), array( 'ahahahahha' ) ), + array( array( 'baz' ), array( 'baz' ), array( 'ahahahahha' ) ), + ); + } + + /** + * @covers Message::params + * @dataProvider provideTestParams + */ + public function testParams( $expected ) { + $msg = new Message( 'imasomething' ); + + $returned = call_user_func_array( array( $msg, 'params' ), array_slice( func_get_args(), 1 ) ); + + $this->assertSame( $msg, $returned ); + $this->assertEquals( $expected, $msg->getParams() ); + } + /** * @covers Message::exists */